#pragma once
#include <queue>
#include <list>
#include "Types.h"
#include "Position.h"
using namespace std;

class ChildrenNode
{
public:
	ChildrenNode(Move& move, Position& position, int depth);
	~ChildrenNode();
	list<ChildrenNode*>* children;


	// async deletion indicator
    bool toBeRemoved;


public:
//	static const int MIN_SCORE = -30000;
//    static const int MAX_SCORE = 30000;

    //private list<Move> legalMoves;
    //private int localScore;
     int currentScore;
     Position position;
     Move previousMove;
     int depth;
    //private int pvDepth;
    //private int key;
    //private String key;


public:
	Move* GetPreviousMove();
	int GetDepth();
	bool IsLeave();
	bool IsCreatedchildren();
	int Createchildren(queue<ChildrenNode>& nodeQueue);
	int GetScore();

private:
	int AlphaBetaWhite(int alpha, int beta, int currentDepth, int maxDepth);
    int AlphaBetaBlack(int alpha, int beta, int currentDepth, int maxDepth);

public:
	void UpdateScore(int maxDepth, bool color);
	void ClearRecursively();

};
